Inside Macintosh: Sound

| Previous | Chapter contents | Chapter top | Section top |

The Sound Resource

You can store sound commands and sound data as a resource with the resource type 'snd ' . Resource IDs from 0 to 8191 are reserved by Apple Computer, Inc. You may use all other resource IDs for your 'snd ' resources.

You can use the GetResource function to search all open resource files for the first 'snd ' resource type with the given ID. The 'snd ' resource type defines a sound resource. Figure 1-24 shows the structure of a sound resource.

Figure 24 The 'snd ' resource type

Often, you can create a sound resource simply by using the SndRecord function, documented in the chapter "Introduction to Sound on the Macintosh" in this book. However, you can also define a sound resource manually. This is especially useful for sound resources that are simply series of sound commands and contain no sampled-sound data. Also, you might construct a sound resource that contains wave-table data manually. A sound resource contains the following elements:

The format of the sound resource header differs depending on whether the 'snd ' resource is format 1 or format 2. Figure 1-25 illustrates the formats of the two types of sound resource header. Both sound headers begin with a format field, which defines the format of the sound resource as either $0001 or $0002.

Figure 25 The sound resource header

 


© 1998 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top |